﻿using System;
using System.Data;
using System.Collections.Generic;

using CoreLab.Oracle; //using Devart.Data.Oracle; //using Oracle.DataAccess.Client;
//using Oracle.DataAccess.Types;

using LMD.Constant;
using LMD.Lib.DataClass;
using LMD.Lib.Oracle;

namespace DBQuery
{
    /// <summary>
    /// Summary description for MonitoringMRTGTable
    /// </summary>
    public static class MonitoringMRTGTable
    {
        public static void UploadMRTG(MRTGData mrtgData)
        {
            DBLib dbl = new DBLib();
            List<OracleParameter> lsParams = new List<OracleParameter>();

            lsParams.Add(new OracleParameter());
            lsParams[lsParams.Count - 1].ParameterName = "out_new_id";
            lsParams[lsParams.Count - 1].Direction = ParameterDirection.Output;
            lsParams[lsParams.Count - 1].OracleDbType = OracleDbType.Number;

            lsParams.Add(new OracleParameter());
            lsParams[lsParams.Count - 1].ParameterName = "in_NETWORK_NO";
            lsParams[lsParams.Count - 1].Direction = ParameterDirection.Input;
            lsParams[lsParams.Count - 1].OracleDbType = OracleDbType.VarChar;
            lsParams[lsParams.Count - 1].Value = mrtgData.sxNetworkNo;

            lsParams.Add(new OracleParameter());
            lsParams[lsParams.Count - 1].ParameterName = "in_NOTE";
            lsParams[lsParams.Count - 1].Direction = ParameterDirection.Input;
            lsParams[lsParams.Count - 1].OracleDbType = OracleDbType.VarChar;
            lsParams[lsParams.Count - 1].Value = mrtgData.sxNote;

            lsParams.Add(new OracleParameter());
            lsParams[lsParams.Count - 1].ParameterName = "in_START_DATE";
            lsParams[lsParams.Count - 1].Direction = ParameterDirection.Input;
            lsParams[lsParams.Count - 1].OracleDbType = OracleDbType.Date;
            lsParams[lsParams.Count - 1].Value = mrtgData.dtmStartDate;

            lsParams.Add(new OracleParameter());
            lsParams[lsParams.Count - 1].ParameterName = "in_END_DATE";
            lsParams[lsParams.Count - 1].Direction = ParameterDirection.Input;
            lsParams[lsParams.Count - 1].OracleDbType = OracleDbType.Date;
            lsParams[lsParams.Count - 1].Value = mrtgData.dtmEndDate; 
            
            lsParams.Add(new OracleParameter());
            lsParams[lsParams.Count - 1].ParameterName = "in_CREATE_BY";
            lsParams[lsParams.Count - 1].Direction = ParameterDirection.Input;
            lsParams[lsParams.Count - 1].OracleDbType = OracleDbType.VarChar;
            lsParams[lsParams.Count - 1].Value = ICPUser.ID;

            lsParams.Add(new OracleParameter());
            lsParams[lsParams.Count - 1].ParameterName = "in_T_FILE_UPLOAD_ID";
            lsParams[lsParams.Count - 1].Direction = ParameterDirection.Input;
            lsParams[lsParams.Count - 1].OracleDbType = OracleDbType.Number;
            lsParams[lsParams.Count - 1].Value = mrtgData.iFileUploadID;

            String sxQuery = "pr_insert_T_MONITORING_MRTG";

            int i = dbl.ExecuteProcedure(sxQuery, lsParams.ToArray());
            
        }
    }
}